package 算法.leetcode.labuladong.数组和链表;

/**
 * @author lchenglong
 * @date 2022/7/12
 */
public class 奇数值单元格的数目 {
    class Solution {
        public int oddCells(int m, int n, int[][] indices) {
            int[][] ans = new int[m][n];
            for (int[] index:indices){
                for (int i=0;i<n;i++){
                    ans[index[0]][i]++;
                }
                for (int i=0;i<m;i++){
                    ans[i][index[1]]++;
                }
            }
            int res = 0;
            for (int i=0;i<m;i++){
                for (int j=0;j<n;j++){
                    if ((ans[i][i]&1)!=0){
                        ++res;
                    }
                }
            }
            return res;
        }
    }
}
